package com.xuecheng.system.interfaces.web;

import com.xuecheng.system.application.service.DictionaryApplication;
import com.xuecheng.system.application.vo.resp.DictionaryDto;
import com.xuecheng.system.domain.model.entity.Dictionary;
import com.xuecheng.system.domain.service.DictionaryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 数据字典 前端控制器
 * </p>
 *
 * @author itcast
 */
@Slf4j
@RestController
@RequestMapping("/dictionary")
public class DictionaryApi {

    @Autowired
    private DictionaryApplication dictionaryApplication;

    @GetMapping("/all")
    public List<DictionaryDto> queryAll() {
        return dictionaryApplication.queryAll();
    }

    @GetMapping("/code/{code}")
    public DictionaryDto getByCode(@PathVariable String code) {
        return dictionaryApplication.getByCode(code);
    }
}
